{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/webuploader.css">
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/style.css">
<style>
    .file-item{float: left; position: relative; width: 110px;height: 110px; margin: 0 20px 20px 0; padding: 4px;}
    .file-item .info{overflow: hidden;}
    .uploader-list{width: 100%; overflow: hidden;}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑错误提示</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal" name="edit" id="edit" method="post" action="{:url('editPost')}">
                        <input type="hidden" name="id" value="{$data.id}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">错误提示来源名称：</label>
                            <div class="input-group col-sm-4">
                                <input id="name" type="text" class="form-control" name="name" value="{$data['name']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">错误提示code：</label>
                            <div class="input-group col-sm-4">
                                <input id="code" type="text" class="form-control" name="code" value="{$data['code']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">键值对key：</label>
                            <div class="input-group col-sm-4">
                                <input id="key" type="text" class="form-control" name="key" value="{$data['key']}">

                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">具体提示信息：</label>
                            <div class="input-group col-sm-4">
                                <input id="message" type="text" class="form-control" name="message" value="{$data['message']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">状&nbsp;态：</label>
                            <div class="col-sm-6">
                                <div class="radio ">
                                    <input type="checkbox" class="js-switch" {if condition="$data['status'] eq 1"}checked{/if}/>&nbsp;&nbsp;默认开启
                                    <input name="status" value="{$data['status']}" type="hidden">
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button id="formSubmit" type="button" class="btn btn-primary"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="/static/admin/webupload/webuploader.min.js"></script>

<script type="text/javascript">
    var $list = $('#fileList');
    //提交
    $(function(){
        $('#formSubmit').click(function() {

            if(common.isNullOrEmpty($('#name').val())){
                layer.msg('请输入错误提示来源名称',{icon:2,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }

            if(common.isNullOrEmpty($('#code').val())){
                layer.msg('请输入错误提示码',{icon:2,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }

            if(common.isNullOrEmpty($('#key').val())){
                layer.msg('请输入对应key',{icon:2,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }

            if(common.isNullOrEmptyForDictionary($('#message').val())){
                layer.msg('请输入错误提示信息',{icon:2,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }

            $("form#edit").submit();

        });
        //IOS开关样式配置
        var elem = document.querySelector('.js-switch');
        var switchery = new Switchery(elem, {
            color: '#1AB394'
        });

        elem.onchange = function () {
            if(elem.checked) {
                $("input[name='status']").val(1);
            } else {
                $("input[name='status']").val(0);
            }
        };
    });

</script>
</body>
</html>